﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.ModelBinding;
using DTO;
using System.Data;
using System.IO;
namespace MyWeb.Component.Home
{
    public partial class Home : System.Web.UI.UserControl
    {
        DataTable dt = new DataTable();
        DBL.Product pro = new DBL.Product();
        DTO.Product prdto = new DTO.Product();
        protected void Page_Load(object sender, EventArgs e)
        {
            Product_SanPham.DataSource = pro.Product_All();
            Product_SanPham.DataBind();
            
        }
        
        public void LoadProduct()
        {
            dt = pro.Product_All();
           
            foreach(DataRow dto in dt.Rows)
            {
                 
                
             // prdto.Image=dto["Image"].ToString();
               

               prdto.Id=int.Parse( dto["Id"].ToString());
               prdto.Name = dto["Name"].ToString();
               prdto.Detail = dto["Detail"].ToString();
               prdto.Price =Double.Parse( dto["Price"].ToString());
               prdto.PriceNew =Double.Parse( dto["PriceNew"].ToString());
               prdto.Date =DateTime.Parse( dto["Id"].ToString());
               prdto.Order = int.Parse(dto["Id"].ToString());
               prdto.Status =int.Parse( dto["Id"].ToString());
               prdto.GroupProduct_Id = int.Parse(dto["Id"].ToString());
             //  Product_SanPham.DataSource += prdto;
              
            }
        }
        
    }
}